Skip to content

[fix]: fix the thread leak when suspend#280

Merged
zhongkechen merged 3 commits intomainfrom
localRunner
Mar 27, 2026
Merged

[fix]: fix the thread leak when suspend#280
zhongkechen merged 3 commits intomainfrom
localRunner

Conversation

@zhongkechen
Copy link
Copy Markdown
Contributor

@zhongkechen zhongkechen commented Mar 27, 2026

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Issue Link, if available

Description

thread leak

Threads waiting for operations to complete will not be terminated when suspending.

This is because when suspending, the exception is not propagated to the thread waiting for operations to complete.

Fix: mark all open completionFuture completed exceptionally when suspending.

race condition

the parent operation is using completionFuture as the lock while the child operation is using parent operation itself as the lock.

try-with-resource exception

When using try-with-resource with parallel operation, if the get() call in the body throws an exception, and close() of parallel operation throws the same exception, try-with-resource will fail with Self-suppression not permitted.

fix: do not throw the exception in close()

Demo/Screenshots

Checklist

  • I have filled out every section of the PR template
  • I have thoroughly tested this change

Testing

Unit Tests

Have unit tests been written for these changes?

Integration Tests

Have integration tests been written for these changes?

Examples

Has a new example been added for the change? (if applicable)

@zhongkechen zhongkechen force-pushed the localRunner branch 2 times, most recently from ee2deec to d5ebd0f Compare March 27, 2026 01:45
@zhongkechen zhongkechen marked this pull request as ready for review March 27, 2026 04:25
@zhongkechen zhongkechen force-pushed the localRunner branch 2 times, most recently from b925835 to 8bd740b Compare March 27, 2026 04:30
@zhongkechen zhongkechen self-assigned this Mar 27, 2026
@zhongkechen zhongkechen force-pushed the localRunner branch 4 times, most recently from f526d93 to 1de6db3 Compare March 27, 2026 05:37
fix examples

prevent Self-suppression not permitted

add error message

update example for waitforcallback

add error messasge

add error data

add error operations

add result
@zhongkechen zhongkechen merged commit de5feb5 into main Mar 27, 2026
15 checks passed
@zhongkechen zhongkechen deleted the localRunner branch March 27, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant